home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / cgazv3n4.zip / DOS4-DIR.ZIP / DOS4.H < prev    next >
C/C++ Source or Header  |  1989-04-23  |  6KB  |  152 lines

  1. /**************************** DOS4.H **********************************\
  2. |*                                                                    *|
  3. |* Structures for use with DOS4.C. & MEMORY.C                         *|
  4. |*                                                                    *|
  5. |* (c) Copyright 1989, David Craig. All rights reserved.              *|
  6. |* Permission is granted to incorporate these functions into a larger *|
  7. |* work and to distribute the resulting executable file.              *|
  8. |*                                                                    *|
  9. |* OK for Microsoft 5.1, Turbo 2.0; All memory models supported.      *|
  10. |*                                                                    *|
  11. \**********************************************************************/
  12.  
  13. typedef unsigned char   byte;
  14. typedef unsigned int    word;
  15. typedef unsigned long   dword;
  16.  
  17. /****************************************************************
  18.  * structures and defines needed to use 6Ch, extended read/write
  19.  ****************************************************************/
  20.  
  21. #define FILE_OPENED     1           /* Function 6Ch - CX register */
  22. #define FILE_CREATED    2           /* Returned by DOS */
  23. #define FILE_REPLACED   3
  24.  
  25. struct  open_mode                   /* Function 6Ch - BX register */
  26. {                                   /* Passed to DOS */
  27.     word    res1        : 1;
  28.     word    commint     : 1;
  29.     word    int24h      : 1;
  30.     word    res2        : 5;
  31.     word    inheritance : 1;
  32.     word    sharing     : 3;
  33.     word    res3        : 1;
  34.     word    access      : 3;
  35. };
  36.  
  37. struct  flag_word                   /* Function 6Ch - DX register */
  38. {                                   /* Passed to DOS */
  39.     word    res1        : 7;
  40.     word    not_exists  : 5;
  41.     word    exists      : 4;
  42. };
  43.  
  44. /***********************************************
  45.  * Boot sector contents
  46.  ***********************************************/
  47. struct boot
  48. {
  49.     byte    jump[3];
  50.     byte    oem_name[8];
  51.     word    bytes_per_sector;       /* BPB begins here */
  52.     byte    sectors_per_au;
  53.     word    reserved_sectors;
  54.     byte    number_of_fats;
  55.     word    number_of_entries;
  56.     word    number_of_sectors;
  57.     byte    media_descriptor;
  58.     word    fat_size;
  59.     word    sectors_per_track;
  60.     word    number_of_heads;
  61.     dword   hidden_sectors;
  62.     dword   big_number_of_sectors;
  63.     byte    physical_drive_number;      /* DOS 4.00 */
  64.     byte    bpb_reserved;
  65.     byte    extended_boot_record_sig;   /* 0x29 */
  66.     dword   volume_serial_number;
  67.     byte    volume_label[11];
  68.     byte    bpb_fat_id[8];
  69. };
  70.  
  71.  
  72. /***********************************************
  73.  * DOS 4.x Disk Table
  74.  ***********************************************/
  75. struct disk_table
  76. {
  77.     byte    designator;
  78.     byte    unit_number;
  79.     word    sector_size;
  80.     byte    cluster_size;
  81.     byte    shift_value;
  82.     word    fat_start;
  83.     byte    fat_copies;
  84.     word    max_entries;
  85.     word    first_sector;
  86.     word    last_cluster;
  87.     word    fat_size;               /* Was a byte pre DOS 4.0 */
  88.     word    dir_start;
  89.     byte    far *ddh;
  90.     byte    media_type;
  91.     byte    drive_used;             /* if zero, drive has been used */
  92.     struct  disk_table far *nxt;
  93. };
  94.  
  95. /***********************************************
  96.  * Packet used to pass large sector numbers
  97.  ***********************************************/
  98. struct packet
  99. {
  100.     dword   starting_sector;
  101.     word    nbr_sectors;
  102.     void    far *buffer;
  103. };
  104.  
  105.  
  106. /***********************************************
  107.  * Memory Control Block (MCB)
  108.  ***********************************************/
  109. struct  mcb
  110. {
  111.     byte    control;                    /* 'M' or 'Z' = last */
  112.     word    owner;                      /* PSP of owner or 0008h - IBMBIO */
  113.     word    size;                       /* Size in paragraphs */
  114.     byte    unk1;
  115.     byte    unk2;
  116.     byte    unk3;
  117.     byte    name[8];                    /* DOS 4.00 */
  118. };
  119.  
  120.  
  121. /***********************************************
  122.  * System info tables accessed thru 52h
  123.  ***********************************************/
  124.  
  125. struct  device_hdr
  126. {
  127.     struct  device_hdr far *next_dev;   /* Pointer to next in chain */
  128.     word    attribute;                  /* Attribute Field */
  129.     word    strategy;                   /* Offset of strategy routine */
  130.     word    intrupt;                    /* Offset of interrupt routine */
  131.     byte    name_unit[8];               /* Character Device - Name */
  132.                                         /* Block Device - Number of Units */
  133.     byte    joined_drive_count;         /* Only in NUL device header */
  134. };
  135.  
  136. struct  func_52h
  137. {
  138.     struct  disk_table far *disk_table; /* Pointer to first disk table */
  139.     byte    far *sft_ptr;               /* System File Table - handle */
  140.     struct  device_hdr far *clock_ptr;  /* Pointer to CLOCK$ device */
  141.     struct  device_hdr far *con_ptr;    /* Pointer to CON device */
  142.     word    max_sec;                    /* Maximum sector size supported */
  143.     byte    far *cache;                 /* First Cache Control Block pointer */
  144.     byte    far *drive_inf;             /* Current Directory Structure */
  145.     byte    far *fcb_ptr;               /* System File Table - FCBs */
  146.     word    size_fcb_table;             /* Size of FCB SFT Table */
  147.     byte    drive_count;
  148.     byte    last_drive;
  149.     struct  device_hdr nul_dev;
  150. };
  151.  
  152.